.class public Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;
.super Landroid/content/BroadcastReceiver;
.source "C2DMReceiver.java"


# static fields
.field public static final C2DM_ACCOUNT_EXTRA:Ljava/lang/String; = "account_name"

.field public static final C2DM_MESSAGE_EXTRA:Ljava/lang/String; = "message"

.field public static final C2DM_MESSAGE_SYNC:Ljava/lang/String; = "sync"


# instance fields
.field private defaultSettings:Landroid/content/SharedPreferences;

.field private editor:Landroid/content/SharedPreferences$Editor;

.field private settings:Landroid/content/SharedPreferences;


# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 29
    invoke-direct {p0}, Landroid/content/BroadcastReceiver;-><init>()V

    return-void
.end method

.method private handleMessage(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 22
    .parameter "context"
    .parameter "intent"

    .prologue
    .line 96
    const-string v18, "c2dm"

    const-string v19, "notificatioN!"

    invoke-static/range {v18 .. v19}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 97
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->defaultSettings:Landroid/content/SharedPreferences;

    move-object/from16 v18, v0

    const-string v19, "pushNotificationsStatus"

    const/16 v20, 0x0

    invoke-interface/range {v18 .. v20}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v18

    if-eqz v18, :cond_1

    .line 152
    :cond_0
    :goto_0
    return-void

    .line 101
    :cond_1
    :try_start_0
    const-string v18, "message"

    move-object/from16 v0, p2

    move-object/from16 v1, v18

    invoke-virtual {v0, v1}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v13

    .line 102
    .local v13, message:Ljava/lang/String;
    new-instance v14, Lorg/json/JSONObject;

    invoke-direct {v14, v13}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 103
    .local v14, messageJson:Lorg/json/JSONObject;
    const-string v18, "post_title"

    move-object/from16 v0, v18

    invoke-virtual {v14, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v17

    .line 104
    .local v17, title:Ljava/lang/String;
    const-string v18, "post_id"

    move-object/from16 v0, v18

    invoke-virtual {v14, v0}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v16

    .line 105
    .local v16, postId:Ljava/lang/String;
    const-string v18, "post_categories"

    move-object/from16 v0, v18

    invoke-virtual {v14, v0}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v5

    .line 108
    .local v5, categories:Lorg/json/JSONArray;
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->defaultSettings:Landroid/content/SharedPreferences;

    move-object/from16 v18, v0

    const-string v19, "keywordFilter"

    const-string v20, ""

    invoke-interface/range {v18 .. v20}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v11

    .line 109
    .local v11, keywordFilter:Ljava/lang/String;
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->defaultSettings:Landroid/content/SharedPreferences;

    move-object/from16 v18, v0

    const-string v19, "hammerDeals"

    const/16 v20, 0x0

    invoke-interface/range {v18 .. v20}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v18

    if-eqz v18, :cond_2

    .line 110
    new-instance v18, Ljava/lang/StringBuilder;

    invoke-static {v11}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v19

    invoke-direct/range {v18 .. v19}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v19, ",Hammer,Knaller,TOP"

    invoke-virtual/range {v18 .. v19}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v18

    invoke-virtual/range {v18 .. v18}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v11

    .line 112
    :cond_2
    const/4 v8, 0x0

    .line 113
    .local v8, filterHasMatched:Z
    invoke-virtual {v11}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v18

    const-string v19, ""

    invoke-virtual/range {v18 .. v19}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v18

    if-nez v18, :cond_3

    .line 114
    const-string v18, ","

    move-object/from16 v0, v18

    invoke-virtual {v11, v0}, Ljava/lang/String;->split(Ljava/lang/String;)[Ljava/lang/String;

    move-result-object v12

    .line 115
    .local v12, keywords:[Ljava/lang/String;
    array-length v0, v12

    move/from16 v19, v0

    const/16 v18, 0x0

    :goto_1
    move/from16 v0, v18

    move/from16 v1, v19

    if-lt v0, v1, :cond_6

    .line 123
    .end local v12           #keywords:[Ljava/lang/String;
    :cond_3
    :goto_2
    const/4 v6, 0x0

    .line 124
    .local v6, categoryHasMatched:Z
    if-nez v8, :cond_5

    .line 125
    new-instance v15, Lde/dealdoktor/app/db/SelectedCategoriesModel;

    move-object/from16 v0, p1

    invoke-direct {v15, v0}, Lde/dealdoktor/app/db/SelectedCategoriesModel;-><init>(Landroid/content/Context;)V

    .line 126
    .local v15, model:Lde/dealdoktor/app/db/SelectedCategoriesModel;
    invoke-virtual {v15}, Lde/dealdoktor/app/db/SelectedCategoriesModel;->getAll()Landroid/database/Cursor;

    move-result-object v4

    .line 127
    .local v4, c:Landroid/database/Cursor;
    invoke-interface {v4}, Landroid/database/Cursor;->moveToFirst()Z

    move-result v18

    if-eqz v18, :cond_5

    .line 129
    :cond_4
    const/4 v9, 0x0

    .local v9, i:I
    :goto_3
    invoke-virtual {v5}, Lorg/json/JSONArray;->length()I

    move-result v18

    move/from16 v0, v18

    if-lt v9, v0, :cond_8

    .line 136
    :goto_4
    if-eqz v6, :cond_a

    .line 142
    .end local v4           #c:Landroid/database/Cursor;
    .end local v9           #i:I
    .end local v15           #model:Lde/dealdoktor/app/db/SelectedCategoriesModel;
    :cond_5
    :goto_5
    invoke-virtual {v11}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v18

    const-string v19, ""

    invoke-virtual/range {v18 .. v19}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v18

    if-nez v18, :cond_b

    if-eqz v8, :cond_b

    if-eqz v6, :cond_b

    .line 143
    const-string v18, "c2dm"

    const-string v19, "keyword filter and category matched"

    invoke-static/range {v18 .. v19}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 144
    const-string v18, "Dealdoktor: Neue Schn\u00e4ppchen"

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    move-object/from16 v2, v18

    move-object/from16 v3, v17

    invoke-direct {v0, v1, v2, v3}, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->showNotification(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto/16 :goto_0

    .line 149
    .end local v5           #categories:Lorg/json/JSONArray;
    .end local v6           #categoryHasMatched:Z
    .end local v8           #filterHasMatched:Z
    .end local v11           #keywordFilter:Ljava/lang/String;
    .end local v13           #message:Ljava/lang/String;
    .end local v14           #messageJson:Lorg/json/JSONObject;
    .end local v16           #postId:Ljava/lang/String;
    .end local v17           #title:Ljava/lang/String;
    :catch_0
    move-exception v7

    .line 150
    .local v7, e:Ljava/lang/Exception;
    const-string v18, "exception"

    const-string v19, "C2DMReceiver handleMessage"

    move-object/from16 v0, v18

    move-object/from16 v1, v19

    invoke-static {v0, v1, v7}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_0

    .line 115
    .end local v7           #e:Ljava/lang/Exception;
    .restart local v5       #categories:Lorg/json/JSONArray;
    .restart local v8       #filterHasMatched:Z
    .restart local v11       #keywordFilter:Ljava/lang/String;
    .restart local v12       #keywords:[Ljava/lang/String;
    .restart local v13       #message:Ljava/lang/String;
    .restart local v14       #messageJson:Lorg/json/JSONObject;
    .restart local v16       #postId:Ljava/lang/String;
    .restart local v17       #title:Ljava/lang/String;
    :cond_6
    :try_start_1
    aget-object v10, v12, v18

    .line 116
    .local v10, keyword:Ljava/lang/String;
    invoke-virtual/range {v17 .. v17}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v20

    invoke-virtual {v10}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v21

    invoke-virtual/range {v21 .. v21}, Ljava/lang/String;->toLowerCase()Ljava/lang/String;

    move-result-object v21

    invoke-virtual/range {v20 .. v21}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v20

    if-eqz v20, :cond_7

    .line 117
    const-string v18, "c2dm"

    invoke-virtual {v10}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v19

    invoke-static/range {v18 .. v19}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 118
    const/4 v8, 0x1

    .line 119
    goto :goto_2

    .line 115
    :cond_7
    add-int/lit8 v18, v18, 0x1

    goto :goto_1

    .line 130
    .end local v10           #keyword:Ljava/lang/String;
    .end local v12           #keywords:[Ljava/lang/String;
    .restart local v4       #c:Landroid/database/Cursor;
    .restart local v6       #categoryHasMatched:Z
    .restart local v9       #i:I
    .restart local v15       #model:Lde/dealdoktor/app/db/SelectedCategoriesModel;
    :cond_8
    const-string v18, "xxx"

    new-instance v19, Ljava/lang/StringBuilder;

    const-string v20, "id"

    move-object/from16 v0, v20

    invoke-interface {v4, v0}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v20

    move/from16 v0, v20

    invoke-interface {v4, v0}, Landroid/database/Cursor;->getInt(I)I

    move-result v20

    invoke-static/range {v20 .. v20}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v20

    invoke-static/range {v20 .. v20}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v20

    invoke-direct/range {v19 .. v20}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v20, " = "

    invoke-virtual/range {v19 .. v20}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v19

    invoke-virtual {v5, v9}, Lorg/json/JSONArray;->getString(I)Ljava/lang/String;

    move-result-object v20

    invoke-virtual/range {v19 .. v20}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v19

    invoke-virtual/range {v19 .. v19}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v19

    invoke-static/range {v18 .. v19}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 131
    const-string v18, "id"

    move-object/from16 v0, v18

    invoke-interface {v4, v0}, Landroid/database/Cursor;->getColumnIndex(Ljava/lang/String;)I

    move-result v18

    move/from16 v0, v18

    invoke-interface {v4, v0}, Landroid/database/Cursor;->getInt(I)I

    move-result v18

    invoke-static/range {v18 .. v18}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v18

    invoke-virtual {v5, v9}, Lorg/json/JSONArray;->getString(I)Ljava/lang/String;

    move-result-object v19

    invoke-virtual/range {v18 .. v19}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v18

    if-eqz v18, :cond_9

    .line 132
    const/4 v6, 0x1

    .line 133
    goto/16 :goto_4

    .line 129
    :cond_9
    add-int/lit8 v9, v9, 0x1

    goto/16 :goto_3

    .line 139
    :cond_a
    invoke-interface {v4}, Landroid/database/Cursor;->moveToNext()Z

    move-result v18

    .line 128
    if-nez v18, :cond_4

    goto/16 :goto_5

    .line 145
    .end local v4           #c:Landroid/database/Cursor;
    .end local v9           #i:I
    .end local v15           #model:Lde/dealdoktor/app/db/SelectedCategoriesModel;
    :cond_b
    invoke-virtual {v11}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v18

    const-string v19, ""

    invoke-virtual/range {v18 .. v19}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v18

    if-eqz v18, :cond_0

    if-eqz v6, :cond_0

    .line 146
    const-string v18, "c2dm"

    const-string v19, "category filter matched"

    invoke-static/range {v18 .. v19}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 147
    const-string v18, "Dealdoktor: Neue Schn\u00e4ppchen"

    move-object/from16 v0, p0

    move-object/from16 v1, p1

    move-object/from16 v2, v18

    move-object/from16 v3, v17

    invoke-direct {v0, v1, v2, v3}, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->showNotification(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto/16 :goto_0
.end method

.method private handleRegistration(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 7
    .parameter "context"
    .parameter "intent"

    .prologue
    const/4 v6, 0x0

    .line 54
    const-string v4, "registration_id"

    invoke-virtual {p2, v4}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    .line 55
    .local v3, registration:Ljava/lang/String;
    const-string v4, "error"

    invoke-virtual {p2, v4}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    if-eqz v4, :cond_6

    .line 57
    const-string v4, "c2dm"

    const-string v5, "registration failed"

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 58
    const-string v4, "error"

    invoke-virtual {p2, v4}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    .line 59
    .local v2, error:Ljava/lang/String;
    const-string v4, "SERVICE_NOT_AVAILABLE"

    if-ne v2, v4, :cond_1

    .line 60
    const-string v4, "c2dm"

    const-string v5, "SERVICE_NOT_AVAILABLE"

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 93
    .end local v2           #error:Ljava/lang/String;
    :cond_0
    :goto_0
    return-void

    .line 61
    .restart local v2       #error:Ljava/lang/String;
    :cond_1
    const-string v4, "ACCOUNT_MISSING"

    if-ne v2, v4, :cond_2

    .line 62
    const-string v4, "c2dm"

    const-string v5, "ACCOUNT_MISSING"

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 63
    :cond_2
    const-string v4, "AUTHENTICATION_FAILED"

    if-ne v2, v4, :cond_3

    .line 64
    const-string v4, "c2dm"

    const-string v5, "AUTHENTICATION_FAILED"

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 65
    :cond_3
    const-string v4, "TOO_MANY_REGISTRATIONS"

    if-ne v2, v4, :cond_4

    .line 66
    const-string v4, "c2dm"

    const-string v5, "TOO_MANY_REGISTRATIONS"

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 67
    :cond_4
    const-string v4, "INVALID_SENDER"

    if-ne v2, v4, :cond_5

    .line 68
    const-string v4, "c2dm"

    const-string v5, "INVALID_SENDER"

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 69
    :cond_5
    const-string v4, "PHONE_REGISTRATION_ERROR"

    if-ne v2, v4, :cond_0

    .line 70
    const-string v4, "c2dm"

    const-string v5, "PHONE_REGISTRATION_ERROR"

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 72
    .end local v2           #error:Ljava/lang/String;
    :cond_6
    const-string v4, "unregistered"

    invoke-virtual {p2, v4}, Landroid/content/Intent;->getStringExtra(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    if-eqz v4, :cond_7

    .line 74
    const-string v4, "c2dm"

    const-string v5, "unregistered"

    invoke-static {v4, v5}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    goto :goto_0

    .line 76
    :cond_7
    if-eqz v3, :cond_0

    .line 77
    const-string v4, "dealdoktor_preferences"

    invoke-virtual {p1, v4, v6}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v4

    invoke-interface {v4}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v1

    .line 79
    .local v1, editor:Landroid/content/SharedPreferences$Editor;
    :try_start_0
    invoke-static {p1, v3}, Lde/dealdoktor/app/data/DataModel;->sendRegistrationId(Landroid/content/Context;Ljava/lang/String;)Ljava/lang/String;

    .line 80
    const-string v4, "registrationIdSent"

    const/4 v5, 0x1

    invoke-interface {v1, v4, v5}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 85
    :goto_1
    const-string v4, "c2dm"

    invoke-static {v4, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 87
    const-string v4, "registrationKey"

    invoke-interface {v1, v4, v3}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    .line 88
    invoke-interface {v1}, Landroid/content/SharedPreferences$Editor;->commit()Z

    goto :goto_0

    .line 81
    :catch_0
    move-exception v0

    .line 82
    .local v0, e:Ljava/lang/Exception;
    const-string v4, "excepiton"

    const-string v5, "C2DMReceiver handleRegistration"

    invoke-static {v4, v5, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    .line 83
    const-string v4, "registrationIdSent"

    invoke-interface {v1, v4, v6}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    goto :goto_1
.end method

.method private showNotification(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V
    .locals 24
    .parameter "context"
    .parameter "title"
    .parameter "text"

    .prologue
    .line 156
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->settings:Landroid/content/SharedPreferences;

    move-object/from16 v21, v0

    const-string v22, "lastPushNotificationTitle"

    const-string v23, ""

    invoke-interface/range {v21 .. v23}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v21

    move-object/from16 v0, p3

    move-object/from16 v1, v21

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v21

    if-eqz v21, :cond_0

    .line 238
    :goto_0
    return-void

    .line 160
    :cond_0
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->settings:Landroid/content/SharedPreferences;

    move-object/from16 v21, v0

    const-string v22, "notificationNumber"

    const/16 v23, 0x0

    invoke-interface/range {v21 .. v23}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I

    move-result v14

    .line 161
    .local v14, notificationNumber:I
    add-int/lit8 v14, v14, 0x1

    .line 162
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->settings:Landroid/content/SharedPreferences;

    move-object/from16 v21, v0

    invoke-interface/range {v21 .. v21}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v21

    move-object/from16 v0, v21

    move-object/from16 v1, p0

    iput-object v0, v1, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->editor:Landroid/content/SharedPreferences$Editor;

    .line 163
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->editor:Landroid/content/SharedPreferences$Editor;

    move-object/from16 v21, v0

    const-string v22, "notificationNumber"

    move-object/from16 v0, v21

    move-object/from16 v1, v22

    invoke-interface {v0, v1, v14}, Landroid/content/SharedPreferences$Editor;->putInt(Ljava/lang/String;I)Landroid/content/SharedPreferences$Editor;

    .line 164
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->editor:Landroid/content/SharedPreferences$Editor;

    move-object/from16 v21, v0

    invoke-interface/range {v21 .. v21}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 166
    const-string v15, "notification"

    .line 167
    .local v15, ns:Ljava/lang/String;
    move-object/from16 v0, p1

    invoke-virtual {v0, v15}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v10

    check-cast v10, Landroid/app/NotificationManager;

    .line 169
    .local v10, mNotificationManager:Landroid/app/NotificationManager;
    const v9, 0x7f020012

    .line 170
    .local v9, icon:I
    move-object/from16 v18, p2

    .line 171
    .local v18, tickerText:Ljava/lang/CharSequence;
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v19

    .line 173
    .local v19, when:J
    new-instance v12, Landroid/app/Notification;

    move-object/from16 v0, v18

    move-wide/from16 v1, v19

    invoke-direct {v12, v9, v0, v1, v2}, Landroid/app/Notification;-><init>(ILjava/lang/CharSequence;J)V

    .line 175
    .local v12, notification:Landroid/app/Notification;
    move-object/from16 v6, p2

    .line 176
    .local v6, contentTitle:Ljava/lang/CharSequence;
    move-object/from16 v5, p3

    .line 178
    .local v5, contentText:Ljava/lang/CharSequence;
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->settings:Landroid/content/SharedPreferences;

    move-object/from16 v21, v0

    invoke-interface/range {v21 .. v21}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v21

    move-object/from16 v0, v21

    move-object/from16 v1, p0

    iput-object v0, v1, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->editor:Landroid/content/SharedPreferences$Editor;

    .line 179
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->editor:Landroid/content/SharedPreferences$Editor;

    move-object/from16 v21, v0

    const-string v22, "lastPushNotificationTitle"

    move-object/from16 v0, v21

    move-object/from16 v1, v22

    move-object/from16 v2, p3

    invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    .line 180
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->editor:Landroid/content/SharedPreferences$Editor;

    move-object/from16 v21, v0

    invoke-interface/range {v21 .. v21}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 182
    new-instance v13, Landroid/content/Intent;

    const-class v21, Lde/dealdoktor/app/activities/Tabs;

    move-object/from16 v0, p1

    move-object/from16 v1, v21

    invoke-direct {v13, v0, v1}, Landroid/content/Intent;-><init>(Landroid/content/Context;Ljava/lang/Class;)V

    .line 183
    .local v13, notificationIntent:Landroid/content/Intent;
    const-string v21, "startFromNotification"

    const/16 v22, 0x1

    move-object/from16 v0, v21

    move/from16 v1, v22

    invoke-virtual {v13, v0, v1}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Z)Landroid/content/Intent;

    .line 184
    const/16 v21, 0x0

    const/high16 v22, 0x800

    move-object/from16 v0, p1

    move/from16 v1, v21

    move/from16 v2, v22

    invoke-static {v0, v1, v13, v2}, Landroid/app/PendingIntent;->getActivity(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;

    move-result-object v4

    .line 185
    .local v4, contentIntent:Landroid/app/PendingIntent;
    iput v14, v12, Landroid/app/Notification;->number:I

    .line 186
    iget v0, v12, Landroid/app/Notification;->number:I

    move/from16 v21, v0

    const/16 v22, 0x1

    move/from16 v0, v21

    move/from16 v1, v22

    if-le v0, v1, :cond_1

    .line 187
    new-instance v21, Ljava/lang/StringBuilder;

    iget v0, v12, Landroid/app/Notification;->number:I

    move/from16 v22, v0

    invoke-static/range {v22 .. v22}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v22

    invoke-static/range {v22 .. v22}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v22

    invoke-direct/range {v21 .. v22}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    const-string v22, " neue Deals"

    invoke-virtual/range {v21 .. v22}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v21

    invoke-virtual/range {v21 .. v21}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v5

    .line 190
    :cond_1
    move-object/from16 v0, p1

    invoke-virtual {v12, v0, v6, v5, v4}, Landroid/app/Notification;->setLatestEventInfo(Landroid/content/Context;Ljava/lang/CharSequence;Ljava/lang/CharSequence;Landroid/app/PendingIntent;)V

    .line 191
    iget v0, v12, Landroid/app/Notification;->flags:I

    move/from16 v21, v0

    or-int/lit8 v21, v21, 0x10

    move/from16 v0, v21

    iput v0, v12, Landroid/app/Notification;->flags:I

    .line 193
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->defaultSettings:Landroid/content/SharedPreferences;

    move-object/from16 v21, v0

    const-string v22, "nightSleep"

    const/16 v23, 0x0

    invoke-interface/range {v21 .. v23}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v11

    .line 195
    .local v11, nightSleep:Z
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->defaultSettings:Landroid/content/SharedPreferences;

    move-object/from16 v21, v0

    const-string v22, "pushSound"

    const-string v23, "#"

    invoke-interface/range {v21 .. v23}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v16

    .line 197
    .local v16, pushSound:Ljava/lang/String;
    invoke-static {}, Ljava/util/Calendar;->getInstance()Ljava/util/Calendar;

    move-result-object v3

    .line 198
    .local v3, calendar:Ljava/util/Calendar;
    if-nez v11, :cond_4

    .line 200
    iget v0, v12, Landroid/app/Notification;->defaults:I

    move/from16 v21, v0

    or-int/lit8 v21, v21, 0x2

    move/from16 v0, v21

    iput v0, v12, Landroid/app/Notification;->defaults:I

    .line 202
    const-string v21, "#"

    move-object/from16 v0, v16

    move-object/from16 v1, v21

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v21

    if-eqz v21, :cond_3

    .line 204
    iget v0, v12, Landroid/app/Notification;->defaults:I

    move/from16 v21, v0

    or-int/lit8 v21, v21, 0x1

    move/from16 v0, v21

    iput v0, v12, Landroid/app/Notification;->defaults:I

    .line 237
    :cond_2
    :goto_1
    const v21, 0x7f08000e

    move/from16 v0, v21

    invoke-virtual {v10, v0, v12}, Landroid/app/NotificationManager;->notify(ILandroid/app/Notification;)V

    goto/16 :goto_0

    .line 207
    :cond_3
    const-string v21, ""

    move-object/from16 v0, v16

    move-object/from16 v1, v21

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v21

    if-nez v21, :cond_2

    .line 208
    invoke-static/range {v16 .. v16}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v21

    move-object/from16 v0, v21

    iput-object v0, v12, Landroid/app/Notification;->sound:Landroid/net/Uri;

    goto :goto_1

    .line 212
    :cond_4
    const/16 v17, 0x16

    .line 213
    .local v17, start:I
    const/4 v8, 0x6

    .line 215
    .local v8, end:I
    :try_start_0
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->defaultSettings:Landroid/content/SharedPreferences;

    move-object/from16 v21, v0

    const-string v22, "nightSleepStart"

    const-string v23, "22"

    invoke-interface/range {v21 .. v23}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v21

    invoke-static/range {v21 .. v21}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;)Ljava/lang/Integer;

    move-result-object v21

    invoke-virtual/range {v21 .. v21}, Ljava/lang/Integer;->intValue()I

    move-result v17

    .line 216
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->defaultSettings:Landroid/content/SharedPreferences;

    move-object/from16 v21, v0

    const-string v22, "nightSleepEnd"

    const-string v23, "6"

    invoke-interface/range {v21 .. v23}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v21

    invoke-static/range {v21 .. v21}, Ljava/lang/Integer;->valueOf(Ljava/lang/String;)Ljava/lang/Integer;

    move-result-object v21

    invoke-virtual/range {v21 .. v21}, Ljava/lang/Integer;->intValue()I
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result v8

    .line 221
    :goto_2
    const/16 v21, 0xb

    move/from16 v0, v21

    invoke-virtual {v3, v0}, Ljava/util/Calendar;->get(I)I

    move-result v21

    move/from16 v0, v21

    move/from16 v1, v17

    if-ge v0, v1, :cond_2

    const/16 v21, 0xb

    move/from16 v0, v21

    invoke-virtual {v3, v0}, Ljava/util/Calendar;->get(I)I

    move-result v21

    move/from16 v0, v21

    if-lt v0, v8, :cond_2

    .line 222
    iget v0, v12, Landroid/app/Notification;->defaults:I

    move/from16 v21, v0

    or-int/lit8 v21, v21, 0x2

    move/from16 v0, v21

    iput v0, v12, Landroid/app/Notification;->defaults:I

    .line 224
    const-string v21, "#"

    move-object/from16 v0, v16

    move-object/from16 v1, v21

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v21

    if-eqz v21, :cond_5

    .line 226
    iget v0, v12, Landroid/app/Notification;->defaults:I

    move/from16 v21, v0

    or-int/lit8 v21, v21, 0x1

    move/from16 v0, v21

    iput v0, v12, Landroid/app/Notification;->defaults:I

    goto/16 :goto_1

    .line 217
    :catch_0
    move-exception v7

    .line 218
    .local v7, e:Ljava/lang/Exception;
    const-string v21, "exception"

    const-string v22, "C2DMReceiver showNotification"

    move-object/from16 v0, v21

    move-object/from16 v1, v22

    invoke-static {v0, v1, v7}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_2

    .line 229
    .end local v7           #e:Ljava/lang/Exception;
    :cond_5
    const-string v21, ""

    move-object/from16 v0, v16

    move-object/from16 v1, v21

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v21

    if-nez v21, :cond_2

    .line 230
    invoke-static/range {v16 .. v16}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v21

    move-object/from16 v0, v21

    iput-object v0, v12, Landroid/app/Notification;->sound:Landroid/net/Uri;

    goto/16 :goto_1
.end method


# virtual methods
.method public onReceive(Landroid/content/Context;Landroid/content/Intent;)V
    .locals 3
    .parameter "context"
    .parameter "intent"

    .prologue
    .line 40
    invoke-static {p1}, Landroid/preference/PreferenceManager;->getDefaultSharedPreferences(Landroid/content/Context;)Landroid/content/SharedPreferences;

    move-result-object v1

    iput-object v1, p0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->defaultSettings:Landroid/content/SharedPreferences;

    .line 41
    const-string v1, "dealdoktor_preferences"

    const/4 v2, 0x0

    invoke-virtual {p1, v1, v2}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v1

    iput-object v1, p0, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->settings:Landroid/content/SharedPreferences;

    .line 42
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v1

    const-string v2, "com.google.android.c2dm.intent.REGISTRATION"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_1

    .line 43
    invoke-direct {p0, p1, p2}, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->handleRegistration(Landroid/content/Context;Landroid/content/Intent;)V

    .line 51
    :cond_0
    :goto_0
    return-void

    .line 44
    :cond_1
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v1

    const-string v2, "com.google.android.c2dm.intent.RECEIVE"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_2

    .line 45
    invoke-direct {p0, p1, p2}, Lde/dealdoktor/app/broadcastReceiver/C2DMReceiver;->handleMessage(Landroid/content/Context;Landroid/content/Intent;)V

    goto :goto_0

    .line 46
    :cond_2
    invoke-virtual {p2}, Landroid/content/Intent;->getAction()Ljava/lang/String;

    move-result-object v1

    const-string v2, "com.android.vending.INSTALL_REFERRER"

    invoke-virtual {v1, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 47
    new-instance v0, Lcom/trademob/tracking/TMInstallBroadcastReceiver;

    invoke-direct {v0}, Lcom/trademob/tracking/TMInstallBroadcastReceiver;-><init>()V

    .line 48
    .local v0, receiver:Lcom/trademob/tracking/TMInstallBroadcastReceiver;
    invoke-virtual {v0, p1, p2}, Lcom/trademob/tracking/TMInstallBroadcastReceiver;->onReceive(Landroid/content/Context;Landroid/content/Intent;)V

    goto :goto_0
.end method
